package com.vhall.component.entity.pendant.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.vhall.component.framework.common.annotation.ParamName;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * @author guoxin.wang
 * @date 2021-10-29 11:19
 */
@Data
public class PendantCreateOrUpdateReqVO implements Serializable {

    private static final long serialVersionUID = 226647574809070555L;

    @ParamName("id")
    private Integer id;

    /**
     * 类型，1=推屏挂件 2=固定挂件
     */
    @NotNull(message = "类型不能为空！")
    @Range(min = 1, max = 2, message = "type只能是1,2")
    @ParamName("type")
    private Integer type;

    /**
     * 挂件名称
     */
    @NotBlank(message = "name参数不允许为空")
    @ParamName("name")
    private String name;

    /**
     * 挂件链接-h5
     */
    @Pattern(regexp = "(\\\\s)?|(http(s)?:\\/\\/.+)", message = "挂件链接格式不正确")
    @ParamName("pendant_url")
    @JsonProperty("pendant_url")
    private String pendantUrl;

    /**
     * 挂件链接-h5
     */
    @Pattern(regexp = "(\\\\s)?|(http(s)?:\\/\\/.+)", message = "挂件链接格式不正确")
    @ParamName("pendant_weixin_url")
    @JsonProperty("pendant_weixin_url")
    private String pendantWeixinUrl;

    /**
     * 挂件图片地址
     */
    @NotBlank(message = "挂件图片 参数不允许为空")
    @Pattern(regexp = "(\\\\s)?|(http(s)?://([\\w-]+\\.)+[\\w-]+[:]?([\\d]+)*(/[\\w- :./?%&=]*)?)", message = "挂件图片地址-链接格式不正确")
    @ParamName("pic")
    private String pic;

}
